// import { useRoute } from 'vue-router';
// const route=useRoute()
// import document from '../views/document/index.vue'
const routes = [
  {
    path: '/document',
    name: 'document',
    meta: {
      title: '文档',
      breadcrumbName: '我的文件夹',
      cached: true,
      keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
    },
    redirect: '/document/l/myfolder',
    isDirectLink: true,
    children: [

      {
        path: 'l', // 空路径确保 /document 直接访问
        name: 'l',
        component: () => import('@/views/document/pages/layout.vue'),
        meta: {
          breadcrumbName: '框',
          title: '框',
          cached: true,
          keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
        },
        redirect: { name: 'MyFolder' },
        children: [
          {
            path: 'myfolder', // 空路径确保 /document 直接访问
            name: 'MyFolder',
            meta: {
              breadcrumbName: '我的文件夹',
              title: '我的文件夹',
              cached: true,
              keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
            }
          },
          {
            path: 'myknowledge', // 空路径确保 /document 直接访问
            name: 'MyKnowledge',
            meta: {
              breadcrumbName: '我的知识库',
              title: '我的知识库',
              cached: true,
              keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
            }
          },
          {
            path: 'mytemplate', // 空路径确保 /document 直接访问
            name: 'MyTemplate',
            component: () => import('@/views/document/pages/MyTemplate.vue'),
            meta: {
              breadcrumbName: '我的模板库',
              title: '我的模板库',
              cached: true,
              keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
            }
          },
          {
            path: 'mybin', // 空路径确保 /document 直接访问
            name: 'MyBin',
            meta: {
              breadcrumbName: '回收站',
              title: '回收站',
              cached: true,
              keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
            }
          },
          {
            path: 'myfoldertest', // 空路径确保 /document 直接访问
            name: 'MyFolderTest',
            meta: {
              breadcrumbName: '测试',
              title: '测试',
              cached: true,
              keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
            }
          },
          {
            path: 'files',
            name: 'Files',
            component: () => import('@/views/document/pages/files.vue'),
            meta: {
              breadcrumbName: '文件',
              // breadcrumbName: (() => {
              //   //刷新后，tab名为文件夹名
              //   // 从 path 中提取 folderName
              //   const path = window.location.pathname
              //   console.log(path);
              //   const folderName = path.split('/files')[1];
              //   return decodeURIComponent(folderName) || '文件'; // 如果 folderName 不存在，返回默认值 '文件'
              // })(),
              title: '文件',
              cached: true,
              keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
            }
          }
        ]
      },
    ],
  },
  {
    path: '/fileEdit', // 空路径确保 /document 直接访问
    name: 'fileEdit',
    meta: {
      breadcrumbName: '文档编辑',
      title: '文档编辑',
      cached: true,
      isDisable: true, // 不显示菜单
      keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
    }
  },
  {
    path: '/upload',
    name: 'upload',
    meta: {
      title: '发布',
      breadcrumbName: '发布',
      cached: true,
      keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
    },
    isDirectLink: true,
  },
  {
    path: '/process',
    name: 'process',
    meta: {
      title: '流程',
      breadcrumbName: '流程',
      cached: true,
      keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
    },
    isDirectLink: true,
    redirect: '/process/processtemplateLib',
    children: [
      {
        path: 'processtemplateLib',
        name: 'processtemplateLib',
        component: () => import('@/views/process/pages/ProcessTemplateLib.vue'),
        meta: {
          title: '流程模板库',
          breadcrumbName: '流程模板库',
          cached: true,
          keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
        },
      },
      {
        path: 'processbin',
        name: 'processbin',
        component: () => import('@/views/process/pages/ProcessBin.vue'),
        meta: {
          title: '回收站',
          breadcrumbName: '回收站',
          cached: true,
          keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
        }
      }
    ]
  },
  {
    path: '/system',
    name: 'system',
    meta: {
      title: '系统',
      breadcrumbName: '用户管理',
      cached: true,
      keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
    },
    isDirectLink: true,
    redirect: '/system/accountrManagement',
    children: [
      {
        path: 'accountrManagement',
        name: 'accountrManagement',
        component: () => import('@/views/system/pages/account.vue'),
        meta: {
          title: '用户管理',
          breadcrumbName: '用户管理',
          cached: true,
          keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
        },
      },
      {
        path: 'logManagement',
        name: 'logManagement',
        component: () => import('@/views/system/pages/log.vue'),
        meta: {
          title: '日志管理',
          breadcrumbName: '日志管理',
          cached: true,
          keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
        },
      },
      {
        path: 'backupAndRecovery',
        name: 'backupAndRecovery',
        component: () => import('@/views/system/pages/backupAndRecovery.vue'),
        meta: {
          title: '备份与恢复',
          breadcrumbName: '备份与恢复',
          cached: true,
          keepAlive: true // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
        },
      }
    ]
  },
  {
    path: '/tableTemplate',
    name: 'tableTemplate',
    meta: {
      title: '表格示例',
      isDisable: false, // 是否禁用路由
    },
    children: [
      {
        path: 'introduce1',
        name: 'introduce1',
        meta: {
          title: '介绍1',
        },
        children: [
          {
            path: 'introduce2',
            name: 'introduce2',
            meta: {
              title: '介绍2',
            }
          },
        ]
      },
    ]
  },
  {
    path: '/trial',
    name: 'trial',
    meta: {
      title: '测试页',
      isDisable: false, // 是否禁用路由
      breadcrumbName: '测试页',
      cached: true,
      keepAlive: false // 设置缓存必须 设置defineOptions({ name: 'xxxx 与路由nama相同' })
    },
    isDirectLink: true
  },

]

// 模拟获取动态路由数据
export function getDynamicRoutes() {
  return new Promise((resolve) => {
    resolve(routes)
  })
  // return routes
}
